package lanQiao;

public class X16Factory
{
	public static void main(String[] args)
	{
		for(int i=0; i<16; i++)
		{
			String a1;
			
			if(i<10)
				a1 = i + "";
			else
				a1 = (char)(i+55) + "";
			for(int j=0; j<16; j++)
			{
				String a2;
				
				if(j<10)
					a2 = j + "";
				else
					a2 = (char)(j+55) + "";
				for(int k=0; k<16; k++)
				{
					String a3;
					
					if(k<10)
						a3 = k + "";
					else
						a3 = (char)(k+55) + "";
					
					System.out.println("n[" + i + "][" + j + "][" + k + "]" + "=" + exchange(a1+a2+a3) + ";");
				}
			}
		}
	}

	private static String exchange(String s)
	{
		int num = 0;
		
		for(char t : s.toCharArray())
		{
			num *= 16;
			if(t<65)
				num += (t - 48);
			else
				num += (t - 55);
		}
		
		String a="";
		
		for(int number=num;number > 0;number /= 8)
		{
			a= number%8+a;
		}
		
		if(a.length() == 0)
			return num + "  0000";
		else if(a.length() == 1)
			return num + "  000" + a;
		else if(a.length() == 2)
			return num + "  00" + a;
		else if(a.length() == 3)
			return num + "  0" + a;
		else
			return num + "  " + a;
	}

}
